package com.guo.fristspringboot.controller;

import com.guo.fristspringboot.entity.Book;
import com.guo.fristspringboot.entity.Score;
import com.guo.fristspringboot.entity.Student;
import com.guo.fristspringboot.mapper.BookMapper;
import com.guo.fristspringboot.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.Callable;

@RestController
@RequestMapping("/stu")
public class StudentController {

    @Autowired
    private StudentMapper studentMapper;

    @RequestMapping("/getAll")
    public List<Student> getAll(){
        return studentMapper.getAll();
    }

    @RequestMapping("/getById")
    public Student getById(){
        Student b=studentMapper.getById("1");
        System.out.println(b.toString());
        return studentMapper.getById("1");
    }
    @RequestMapping("/getAllandScore")
    public List<Student> getAllandScore(){
        List<Student>  student = studentMapper.getAllandScore("01");
        return student;
    }

    @RequestMapping("/getThisOne")
    public List<Student> getThisOne(){
        List<Student>  student = studentMapper.getThisOne("张三","01");
        return student;
    }

    @RequestMapping("/getSoms")
    public List<Student> getSoms(){
        List<Student>  student = studentMapper.getSoms("01","男");
        return student;
    }

    @RequestMapping("/getLike")
    public List<Student> getLike(@RequestParam("s_name") String s_name){
        List<Student>  student = studentMapper.getLike(s_name);
        return student;
    }

}
